#include<bits/stdc++.h>
using namespace std;
int n,m,ans=0;
int T;
int d[1001],v[1001]={0},a[1001];
int num[1001];
int l,vv,x1=0;
int vis[1001];
int t=0;
int p,p1=0;
int cnt=0;
int pd()
{
    for(int i=1;i<=m;i++)
    {
        if(x1+d[i]>num[i]&&x1+d[i]<num[i+1])
        return num[i+1];
    }
}
int main()
{
    freopen("detect.in","r",stdin);
    freopen("detect.out","w",stdout);
    cin>>T;
    cin>>n>>m>>l>>vv;
    for(int i=1;i<=n;i++)
    {
        cin>>d[i]>>v[i]>>a[i];
    }
    for(int i=1;i<=m;i++)
    cin>>num[i];
    sort(num+1,num+1+m);
    for(int i=1;i<=n;i++)
    {
        x1=0;
        if(a[i]==0)
        {
            if(v[i]>vv)
            {
                ans++;
                break;
            }
            vis[pd()]=1;
        }
        else if(a[i]>0)
        {
            if(v[i]>vv)
            {
                vis[pd()]=1;
                break;
            }
            else
            {
                p=pd();
                x1=((vv*vv)-(v[i]*v[i]))/(2*a[i]);
                p1=pd();
                if(p!=p1)
                {
                    vis[p1]=1;
                    break;
                }
                else
                {
                    ans++;
                    break;
                }
            }
        }
        else
        {
            if(v[i]<vv)
            {
                ans++;
                break;
            }
            else
            {
                p=pd();
                x1=((vv*vv)-(v[i]*v[i]))/(2*a[i]);
                p1=pd();
                if(p!=p1)
                {
                    vis[p1]=1;
                    break;
                }
                else
                {
                    ans++;
                    break;
                }
            }
        }
    }
    for(int i=1;i<=m;i++)
    {
        if(vis[i]==0)
        cnt++;
    }
    cout<<ans<<' '<<cnt<<endl;
    return 0;
}
